<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>菜单列表</title>
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
		<script src="../js/vue.js"></script>
		<!-- 引入组件库 -->
		<script src="https://unpkg.com/element-ui/lib/index.js"></script>
		<!-- 引入axios -->
		<script src="../js/axios.js"></script>
		<script src="../js/qs.js"></script>
		<!-- 导入jquery -->
		<script src="../js/jquery.min.js"></script>
	</head>
	<body>

		<div style="margin-left: 15px; margin-top:10px ;" id="app1">
			<div style="width: 100%;margin-left: 15px;height:60px;  display: block;">
				<i class="el-icon-caret-right" style="line-height: 40px;margin-right: 5px; float: left;"></i>
				<template style="margin-top: 20px;">
					<el-select v-model="value7" @change="findchange()" filterable placeholder="全部数据" style="float: left;width: 120px; height: 60px;">
						<el-option v-for="item in allcomoptions" :key="item.value" :label="item.label" :value="item.value">
						</el-option>
					</el-select>
				</template>
				<i class="el-icon-search" style="line-height: 40px;float: left;margin-left: 10px; width: 50px; height: 50px;"></i>
				<!-- 搜索框 -->
				<div style="display: block;margin-left: -20px;float: left; cursor: pointer;">
					<el-input style="width: 200px;" placeholder="" v-model="inputtheme">
						<el-button slot="append" @click="searchMenus()" style=" width: 80px;">
							菜单名
						</el-button>
					</el-input>
				</div>
			</div>

			<!-- 新建回款记录 -->

			<span style="font-size: 13px; color: #333333;">菜单列表<a style="font-size: 12px;color: #807E7E;">&nbsp;共${page.total}条</a></span>
			<div style=" width: 98%;padding-left: 5px;">
				<el-button size="small" icon="el-icon-circle-plus" style="float: right; margin-top: -40px;" @click="addMenus()"
				 style="width: 80px;"> 新建</el-button>

				<el-dialog title="添加菜单列表" width="45%" :visible.sync="addMenusdialog">
					<hr style="border: 0.5px solid #666666;margin: -15px 0px 35px;" />
					<el-form :rules="rules" ref="addMenusfroms" :model="addMenusfroms">
						<el-row :gutter="10">
							<el-form-item label="名称:" required prop="pName" :label-width="formLabelWidth">
								<el-input v-model="addMenusfroms.pName" style="width: 80%;" placeholder="请输入名称"></el-input>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="路径:" required prop="pUrl" :label-width="formLabelWidth">
								<el-input v-model="addMenusfroms.pUrl" style="width: 80%;" placeholder="请输入URl"></el-input>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="排序:" prop="pSeq" :label-width="formLabelWidth">
								<template>
									<el-input-number v-model="addMenusfroms.pSeq" :controls="false" :min="0" :max="100" label="描述文字"></el-input-number>
								</template>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="上级菜单:" prop="parentId" :label-width="formLabelWidth">
								<el-select v-model="addMenusfroms.parentId" @clear="clearAllDept()" clearable filterable="" style="width: 80%;"
								 remote="" reserve-keyword placeholder="请选择上级菜单" :remote-method="menusmoteMethod" :loading="menusloading">
									<i slot="prefix" class="el-input__icon el-icon-search"></i>
									<el-option v-for="item in findMenu" :key="item.value" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="图标路径:" prop="pIcon" :label-width="formLabelWidth" v-if="addMenusfroms.parentId==0">
								<el-input v-model="addMenusfroms.pIcon" style="width: 50%; font-size: 12px;" placeholder="请输入图标路径"></el-input>
								<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">上传图标</div>
									<i class="el-icon-tickets" @click="changIcon()" style="font-size:18px"></i>
								</el-tooltip>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="描述:" :label-width="formLabelWidth">
								<el-input type="textarea" :rows="12" :autosize="{ minRows: 3}" placeholder="" v-model="addMenusfroms.pDescript"
								 style="width: 80%;"></el-input>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="状态:" required prop="pState" :label-width="formLabelWidth">
								<template>
									<el-radio v-model="addMenusfroms.pState" label="1283">启用</el-radio>
									<el-radio v-model="addMenusfroms.pState" label="1285">禁用</el-radio>
								</template>
							</el-form-item>
						</el-row>
					</el-form>


					<div slot="footer" class="dialog-footer">
						<el-button @click="dialogFormVisible = false">取 消</el-button>
						<!-- dialogFormVisible = false -->
						<el-button type="primary" @click="submitMenusForm('addMenusfroms')">保存</el-button>
					</div>
				</el-dialog>

			</div>
			<div style=" height: 40px;  width: 98.5%;">
				<el-dialog title="修改菜单列表" width="45%" :visible.sync="updateMenusdialog">
					<hr style="border: 0.5px solid #666666;margin: -15px 0px 35px;" />
					<el-form :rules="rules" ref="updateMenusfroms" :model="updateMenusfroms">
						<el-row :gutter="10">
							<el-form-item label="名称:" required prop="pName" :label-width="formLabelWidth">
								<el-input v-model="updateMenusfroms.pName" style="width: 80%;" placeholder="请输入名称"></el-input>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="路径:" required prop="pUrl" :label-width="formLabelWidth">
								<el-input v-model="updateMenusfroms.pUrl" style="width: 80%;" placeholder="请输入URL"></el-input>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="排序:" prop="pSeq" :label-width="formLabelWidth">
								<template>
									<el-input-number v-model="updateMenusfroms.pSeq" :controls="false" :min="0" :max="100" label="描述文字"></el-input-number>
								</template>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="上级菜单:" prop="parentId" :label-width="formLabelWidth">
								<el-select v-model="updateMenusfroms.parentId" @clear="clearAllDept()" clearable filterable="" style="width: 80%;"
								 remote="" reserve-keyword placeholder="请选择上级菜单" :remote-method="menusmoteMethod" :loading="menusloading">
									<i slot="prefix" class="el-input__icon el-icon-search"></i>
									<el-option v-for="item in findMenu" :key="item.value" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="图标路径:" prop="pIcon" :label-width="formLabelWidth" v-if="updateMenusfroms.parentId==0">
								<el-input v-model="updateMenusfroms.pIcon" style="width: 50%; font-size: 12px;" placeholder="请输入图标路径"></el-input>
								<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">上传图标</div>
									<i class="el-icon-tickets" @click="changIcon()" style="font-size:18px"></i>
								</el-tooltip>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="描述:" :label-width="formLabelWidth">
								<el-input type="textarea" :rows="12" :autosize="{ minRows: 3}" placeholder="" v-model="updateMenusfroms.pDescript"
								 style="width: 80%;"></el-input>
							</el-form-item>
						</el-row>
						<el-row :gutter="10">
							<el-form-item label="状态:" required prop="pState" :label-width="formLabelWidth">
								<template>
									<el-radio v-model="updateMenusfroms.pState" :label="1283">启用</el-radio>
									<el-radio v-model="updateMenusfroms.pState" :label="1285">禁用</el-radio>
								</template>
							</el-form-item>
						</el-row>
					</el-form>


					<div slot="footer" class="dialog-footer">
						<el-button @click="dialogFormVisible = false">取 消</el-button>
						<!-- dialogFormVisible = false -->
						<el-button type="primary" @click="updateMenusForm('updateMenusfroms')">保存</el-button>
					</div>
				</el-dialog>
				<el-dialog title="上传图标" width="30%" :visible.sync="changIcondialog">
					<el-upload ref="upload" action="/upload" name="picture" list-type="picture-card" :limit="1" :file-list="fileList"
					 :on-exceed="onExceed" :before-upload="beforeUpload" :on-preview="handlePreview" :on-success="handleSuccess"
					 :on-remove="handleRemove">
						<i class="el-icon-plus"></i>
					</el-upload>
					<el-dialog :visible.sync="dialogVisible">
						<img width="100%" :src="dialogImageUrl" alt="">
					</el-dialog>

				</el-dialog>
				<template>
					<el-table ref="multipleTable" tooltip-effect="dark" :data="multipleTable" border style="width: 100%;color: black;">
						<el-table-column type="selection" width="35" align="center">
						</el-table-column>
						<el-table-column prop="pId" label="编号" width="60" align="center">
						</el-table-column>
						<el-table-column prop="pName" label="名称" width="120" align="center">
						</el-table-column>
						<el-table-column prop="pUrl" label="路径" align="center">
						</el-table-column>
						<el-table-column prop="pSeq" label="排序" width="60" align="center">
						</el-table-column>
						<el-table-column prop="parentName" label="上级菜单" width="100" align="center">
						</el-table-column>
						<el-table-column prop="pDescript" label="描述" align="center">
						</el-table-column>
						<el-table-column prop="stateName" label="状态" width="70" align="center">
						</el-table-column>
						<el-table-column fixed="right" label="操作" width="100" align="center">
							<template slot-scope="scope">
								<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">编辑</div>
									<i class="el-icon-edit" @click="updatehandleClick(scope.row.pId)" style="font-size: 17px;"></i>
								</el-tooltip>
								<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">删除</div>
									<i class="el-icon-delete" style="margin: 0px 10px;font-size: 17px;" @click="deleteMenushow(scope.row.pId)"></i>
								</el-tooltip>

								<el-dialog title="提示" :visible.sync="dialogDelete" width="30%" append-to-body>
									<span>你确定要删除吗？</span>
									<span slot="footer" class="dialog-footer">
										<el-button @click="dialogDelete = false">取 消</el-button>
										<el-button type="primary" @click="dialogDelete = false" v-on:click="DeleteMenus">确 定</el-button>
									</span>
								</el-dialog>

							</template>
						</el-table-column>
					</el-table>
					<div style="margin-top: 10px">
						<div style="display: block; float: left;margin-left: 5px;">
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">删除</div>
								<i class="el-icon-delete" style="margin: 8px;font-size: 17px;"></i>
							</el-tooltip>
						</div>
						<!-- 分页 -->
						<div style="display: block; float: left;  margin-left: 150px;">
							<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage4"
							 :page-sizes="[4, 6, 10,15]" :page-size="pages.pageSize" layout="total, sizes,prev, pager, next, jumper" :total="pages.total">
							</el-pagination>
						</div>
						<div style="display: block; float: right;margin-right: 15px;">
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">打印</div>
								<el-button circle size="mini"><i class="el-icon-printer" style="font-size: 17px;"></i></el-button>&nbsp;
							</el-tooltip>

							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">导出Excel</div>
								<el-button circle size="mini"><i class="el-icon-tickets" style="font-size: 17px;"></i></el-button>
							</el-tooltip>

						</div>
					</div>
				</template>
			</div>
		</div>

		<script type="text/javascript">
			var pageinfo = ${
				pagejson
			};
			var listTable = ${
				list
			};
			var app1 = new Vue({
				el: "#app1",
				data: {
					value7:'',
					formLabelWidth: '90px',
					allcomoptions: [{
						value: '0',
						label: '全部数据'
					},{
						value: '1283',
						label: '启用'
					},{
						value: '1285',
						label: '禁用'
					}
					],
					allcominfor: '',
					complaintheme: '',
					addMenusdialog: false,
					updateMenusdialog: false,
					changIcondialog: false,
					multipleTable: listTable,
					listNum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
					rules: {
						pName: [{
							required: true,
							message: '请输入菜单名称',
							trigger: 'change',
							required: true,
							message: '请输入菜单名称',
							trigger: 'blur'
						}, ],
						pUrl: [{
							required: true,
							message: '请输入链接地址',
							trigger: 'change',
							required: true,
							message: '请输入链接地址',
							trigger: 'blur'
						}, ],
						parentId: [{
							required: true,
							message: '请选择上级菜单',
							trigger: 'change',
							required: true,
							message: '请选择上级菜单',
							trigger: 'blur'
						}, ],
						pState: [{
							required: true,
							message: '请选择状态',
							trigger: 'change',
							required: true,
							message: '请选择状态',
							trigger: 'blur'
						}, ],
					},
					addMenusfroms: {
						pId: '',
						pName: '',
						pUrl: '',
						pSeq: '',
						pIcon: '',
						parentId: '',
						pDescript: '',
						pState: '1283',
					},
					updateMenusfroms: {
						pId: '',
						pName: '',
						pUrl: '',
						pSeq: '',
						pIcon: '',
						parentId: '',
						pDescript: '',
						pState: '',
					},
					findMenu: [],
					findMenus: [],
					menusloading: false,
					inputtheme:'',
					pages: pageinfo,
					currentPage4: pageinfo.pageNum,
					dialogDelete: false,
					file: '',
					//文件上传的参数
					dialogImageUrl: '',
					dialogVisible: false,
					//图片列表（用于在上传组件中回显图片）
					fileList: '',
				},
				methods: {
					imgurl(id) {
						if (id < 10) {
							id = "0" + id;
						}
						return "../imgs/homepage/img/coin" + id + ".png";
					},
					addMenus() {
						var _this = this;
						axios.post("/authority/addMenusview",
							//ajax请求成功的回调函数
						).then(function(v) {
							console.log("回调成功，获取了服务器端返回的值v");
							console.log(v.data);
							//将数据装换成界面显示
							_this.findMenus = v.data.parent.map(item => {
								return {
									value: item.pId,
									label: item.pName
								};
							});
							_this.findMenu = _this.findMenus;
							_this.addMenusdialog = true;
						}).catch(function() {
							alert("信息出错了");
						});
					},
					clickDept(id) {
						alert(id);
					},
					//文件上传
					getFile(event) {
						this.file = event.target.files[0];
						console.log(this.file);
					},
					addImage(event) {
						event.preventDefault();
						let formData = new FormData();
						formData.append('file', this.file);
						let config = {
							/* headers: {
								'Content-Type': 'multipart/form-data'
							} */
						}
						axios.post('/authority/singlefile', formData /* , config */ ).then(function(response) {
							if (response.status === 200) {
								console.log(response.data);
							}
						})
					},
					handleSuccess(res, file) {
						this.$message({
							type: 'info',
							message: '图片上传成功',
							duration: 6000
						});
						if (file.response.success) {
							this.addMenusfroms.pIcon = file.response.message; //将返回的文件储存路径赋值picture字段
							this.updateMenusfroms.pIcon = file.response.message;
						}
					},
					//选择图片方法
					changIcon() {
						alert("选择图片");
						this.changIcondialog = true;
					},
					//删除文件之前的钩子函数
					handleRemove(file, fileList) {
						this.$message({
							type: 'info',
							message: '已删除原有图片',
							duration: 6000
						});
					},
					//点击列表中已上传的文件事的钩子函数
					handlePreview(file) {},
					//上传的文件个数超出设定时触发的函数
					onExceed(files, fileList) {
						this.$message({
							type: 'info',
							message: '最多只能上传一个图片',
							duration: 6000
						});
					},
					//文件上传前的前的钩子函数
					//参数是上传的文件，若返回false，或返回Primary且被reject，则停止上传
					beforeUpload(file) {
						const isJPG = file.type === 'image/jpeg';
						const isGIF = file.type === 'image/gif';
						const isPNG = file.type === 'image/png';
						const isBMP = file.type === 'image/bmp';
						const isLt2M = file.size / 1024 / 1024 < 2;

						if (!isJPG && !isGIF && !isPNG && !isBMP) {
							this.$message.error('上传图片必须是JPG/GIF/PNG/BMP 格式!');
						}
						if (!isLt2M) {
							this.$message.error('上传图片大小不能超过 2MB!');
						}
						return (isJPG || isBMP || isGIF || isPNG) && isLt2M;
					},
					findchange(){
						var pageSize= Max.pasSize;
						var statusid=null;
						var search=null;
						var _this=this;
						if(this.value7.toString()== "2"){
							window.location.hash='#/authority/menus';
						}else{
							window.location.hash='#/authority/menus?statusid='+this.value7;
							statusid=this.value7;
						}
						this.inputtheme='';
						$.ajax({
						      type: "post",
						      url: "/authority/menus",
						      data: {pageNum:1,pageSize:pageSize,statusid:statusid,search:search},
						      success: function (sdata) {
						    	  console.log("页数打印*****："+sdata);
						    	 _this.multipleTable=sdata.list;
						    	 _this.pages=sdata;
						    	 _this.currentPage4=sdata.pageNum;
						      }
						});
					},
					updatehandleClick(id) {

						var _this = this;
						axios.post("/authority/updateMenusview",
							Qs.stringify({
								'ID': id,
							}, {
								arrayFormat: 'brackets'
							})
							//ajax请求成功的回调函数
						).then(function(v) {
							console.log("回调成功，获取了服务器端返回的值v");
							console.log(v.data);
							//将数据装换成界面显示
							_this.findMenus = v.data.parent.map(item => {
								return {
									value: item.pId,
									label: item.pName
								};
							});
							_this.findMenu = _this.findMenus;
							if(v.data.menurs.pIcon!=null)
							 fileList=[{
								 name:'',
								 url:v.data.menurs.pIcon,
							 }] 
							_this.updateMenusfroms.pId = v.data.menurs.pId;
							_this.updateMenusfroms.pIcon = v.data.menurs.pIcon;
							
							_this.updateMenusfroms.pName = v.data.menurs.pName;
							_this.updateMenusfroms.pUrl = v.data.menurs.pUrl;
							_this.updateMenusfroms.pSeq = v.data.menurs.pSeq;
							_this.updateMenusfroms.parentId = v.data.menurs.parentId;
							_this.updateMenusfroms.pDescript = v.data.menurs.pDescript;
							_this.updateMenusfroms.pState = v.data.menurs.pState;
							console.log(_this.findMenus);
							_this.updateMenusdialog = true;
						}).catch(function() {
							alert("信息出错了");
						});
					},
					handleSizeChange(val) {
						Max.pasSize=val;
						var statusid=null;
						var search=null;
						var _this=this;
						//判断是否带条件;
						var url= window.location.href;
						var url1= url.indexOf("?");
						if(url1!=-1){
							//截取每一个条件
							var urlcondition= url.substring(url1+1,url.length).split('&');
							for(var i=0;i<urlcondition.length;i++){
								
								if(urlcondition[i].split('=')[0]=="statusid"){
									statusid=decodeURI(urlcondition[i].split('=')[1]);
								}
								if(urlcondition[i].split('=')[0]=="search"){
									search=decodeURI(urlcondition[i].split('=')[1]);
								}
							}
						}
						$.ajax({
						      type: "post",
						      url: "/authority/menus",
						      data: {pageNum:1,pageSize:val,statusid:statusid,search:search},
						      success: function (sdata) {
						    	  console.log("页数打印*****："+sdata);
						    	 _this.multipleTable=sdata.list;
						    	 _this.pages=sdata;
						    	 _this.currentPage4=sdata.pageNum;
						      }
						});
					},
					handleCurrentChange(val) {
						//查询的行数
						var pageSize= Max.pasSize;
						var statusid=null;
						var search=null;
						var _this=this;
						//判断是否带条件;
						var url= window.location.href;
						var url1= url.indexOf("?");
						if(url1!=-1){
							//this.complaintheme=decodeURI(url.substring(url1+1,url.length).split('&')[0].split('=')[1]);
							//截取每一个条件
							var urlcondition= url.substring(url1+1,url.length).split('&');
							for(var i=0;i<urlcondition.length;i++){
								
								if(urlcondition[i].split('=')[0]=="statusid"){
									statusid=decodeURI(urlcondition[i].split('=')[1]);
								}
								if(urlcondition[i].split('=')[0]=="search"){
									search=decodeURI(urlcondition[i].split('=')[1]);
								}
							}
						}
						$.ajax({
						      type: "post",
						      url: "/authority/menus",
						      data: {pageNum:val,pageSize:pageSize,statusid:statusid,search:search},
						      success: function (sdata) {
						    	  console.log("页数打印*****："+sdata);
						    	 _this.multipleTable=sdata.list;
						    	 _this.pages=sdata;
						    	 _this.currentPage4=sdata.pageNum;
						      }
						});
					},
					deleteDept(id) {
						alert(id);
					},
					//加载
					menusmoteMethod(query) {
						var _this = this;
						if (query !== '') {
							this.menusloading = true;
							setTimeout(() => {
								this.menusloading = false;
								this.findMenu = _this.findMenus.filter(item => {
									return item.label.toLowerCase()
										.indexOf(query.toLowerCase()) > -1;
								});
							}, 200);
						} else {
							this.findMenu = this.findMenus;
						}
					},
					clearAllDept() {
						this.findMenu = this.findMenus;
					},
					//添加部门
					submitdeptForm(addDeptfroms) {
						var _this = this;
						this.$refs[addDeptfroms].validate((valid) => {
							if (valid) {
								//post提交数据
								axios.post("/authority/addDept",
									//参数转换
									Qs.stringify(
										this.addDeptfroms, {
											arrayFormat: 'brackets'
										})
									//	params:
									//ajax请求成功的回调函数
								).then(function(v) {
									console.log("回调成功，获取了服务器端返回的值v");
									console.log(v);
									_this.addDeptdialog = false;
									showAtRight('/authority/menus');
								}).catch(function() {
									alert("出错了");
								});
							} else {
								console.log('error submit!!');
								return false;
							}
						});
					},
					submitupdatedeptForm(addDeptfroms) {
						var _this = this;
						this.$refs[addDeptfroms].validate((valid) => {
							if (valid) {
								//post提交数据
								axios.post("/authority/updateDept",
									//参数转换
									Qs.stringify(
										this.updateDeptfroms, {
											arrayFormat: 'brackets'
										})
									//	params:
									//ajax请求成功的回调函数
								).then(function(v) {
									console.log("回调成功，获取了服务器端返回的值v");
									console.log(v);
									_this.updateDeptdialog = false;
									showAtRight('/authority/menus');
								}).catch(function() {
									alert("出错了");
								});
							} else {
								console.log('error submit!!');
								return false;
							}
						});
					},

					submitMenusForm(addMenusfroms) {
						var _this = this;
						this.$refs[addMenusfroms].validate((valid) => {
							if (valid) {
								//post提交数据
								axios.post("/authority/addMenus",
									//参数转换
									Qs.stringify(
										this.addMenusfroms, {
											arrayFormat: 'brackets'
										})
									//	params:
									//ajax请求成功的回调函数
								).then(function(v) {
									console.log("回调成功，获取了服务器端返回的值v");
									console.log(v);
									_this.addMenusdialog = false;
									showAtRight('/authority/menus');
								}).catch(function() {
									alert("出错了");
								});
							} else {
								console.log('error submit!!');
								return false;
							}
						});
					},
					updateMenusForm(addDeptfroms) {
						var _this = this;
						this.$refs[addDeptfroms].validate((valid) => {
							if (valid) {
								//post提交数据
								axios.post("/authority/updateMenus",
									//参数转换
									Qs.stringify(
										this.updateMenusfroms, {
											arrayFormat: 'brackets'
										})
									//	params:
									//ajax请求成功的回调函数
								).then(function(v) {
									console.log("回调成功，获取了服务器端返回的值v");
									console.log(v);
									_this.updateMenusdialog = false;
									showAtRight('/authority/menus');
								}).catch(function() {
									alert("出错了");
								});
							} else {
								console.log('error submit!!');
								return false;
							}
						});
					},
					//删除用户接口
					DeleteMenus() {
						var _this = this;
						axios.post("/sales/prosale/deletetrm",
								//参数转换
								Qs.stringify({
									'ID': _this.ID
								}, {
									arrayFormat: 'brackets'
								})
								//ajax请求成功的回调函数
							).then(function(response) {
								console.log("回调成功，获取了服务器端返回的值v");
								console.log(response.data);
								/* this.$message({
								type: 'success',
								message: '删除成功!'
							}); */
								alert("删除成功！");
								window.location.href = '/sales/prosale/returnMoney';

							})
							.catch(function() {
								alert("删除失败！");
								/*this.$message({
								type: 'error',
								message: '删除失败!'*/
							});
						//这个是数据的初始化
					},
					deleteMenushow(ID) {
						this.ID = ID;
						this.dialogDelete = true;

					},
					searchMenus() {
						var pageSize= Max.pasSize;
						var statusid=null;
						var search=null;
						var _this=this;
						//判断是否带条件;
						//判断是否根据条件筛选
						if(this.value7.toString()=='2'||this.value7.toString()==''){
							if(this.inputtheme==""){
								window.location.hash='#/authority/menus'
							}
							else{
								window.location.hash='#/authority/menus?search='+this.inputtheme;
								search=this.inputtheme;
							}
						}else{
							statusid=this.value7.toString();
							if(this.inputtheme==""){
								window.location.hash=window.location.hash.split('&')[0];
							}
							else{
								window.location.hash=window.location.hash.split('&')[0]+'&search='+this.inputtheme;
								search=decodeURI(this.inputtheme);
							}
						}
						$.ajax({
						      type: "post",
						      url: "/authority/menus",
						      data: {pageNum:1,pageSize:pageSize,statusid:statusid,search:search},
						      success: function (sdata) {
						    	  console.log("页数打印*****："+sdata);
						    	 _this.multipleTable=sdata.list;
						    	 _this.pages=sdata;
						    	 _this.currentPage4=sdata.pageNum;
						      }
						});
					}

				},
				mounted: function() {
					var url = window.location.href;
					var url1 = url.indexOf("?");
					if (url1 != -1) {
						this.complaintheme = decodeURI(url.substring(url1 + 1, url.length).split('&')[0].split('=')[1]);
					}
				}
			});
		</script>
	</body>
</html>
